package com.cake21.test.webtest.page;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

public class CheckOut {
	
	WebDriver driver;
	
	@FindBy(id="IDsubmitorder")
	private WebElement submitOrderBtn;
	
	@FindBy(id="ship_time_scope")
	private WebElement shipTimeInput;
	
	public CheckOut(WebDriver driver)
	{
		this.driver = driver;
		PageFactory.initElements(driver, this);
	}
	
	public void selectShipTime()
	{
		this.shipTimeInput.click();
		List<WebElement> shipTimeList = this.driver.findElement(By.id("ship_time_scope_list")).findElements(By.className("scope_item"));
		shipTimeList.get(shipTimeList.size()-1).click();
	}
	
	public void goSubmitOrder()
	{
		this.submitOrderBtn.click();
	}
}
